
import axios from 'axios';

/**
 * 收获地址
 */
export class ShippingAddressService {
    // 分页查询列表
    static findShippingAddresss (queryParams) {
        return axios({
            url: '/mall/User/ShippingAddress/findShippingAddresss',
            method: 'POST',
            data: queryParams
        });
    }

    //根据ID查询指定的收获地址
    static findShippingAddress (shippingAddressId) {
        const query = {
            shippingAddressId
        }
        return axios({
            url: '/mall/User/ShippingAddress/findShippingAddress',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的收获地址(包含外键名称)
    static findShippingAddressForView (shippingAddressId) {
        const query = {
            shippingAddressId
        }
        return axios({
            url: '/mall/User/ShippingAddress/findShippingAddressForView',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的收获地址(包含外键名称)
    static findShippingAddressForEdit (shippingAddressId) {
        const query = {
            shippingAddressId
        }
        return axios({
            url: '/mall/User/ShippingAddress/findShippingAddressForEdit',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的收获地址(只提取ID 和 Name)
    static findShippingAddresssWithIdNameById (shippingAddressId) {
        const query = {
            shippingAddressId
        }
        return axios({
            url: '/mall/User/ShippingAddress/findShippingAddresssWithIdNameById',
            method: 'POST',
            params: query,
        });
    }

    //根据名称查询收获地址集合(只提取ID 和 Name)
    static findShippingAddresssWithIdNameByName (shippingAddressName) {
        const query = {
            shippingAddressName
        }
        return axios({
            url: '/mall/User/ShippingAddress/findShippingAddresssWithIdNameByName',
            method: 'POST',
            params: query,
        });
    }

    //新增保存收获地址
    static saveShippingAddress (shippingAddress) {
        const query = {}
        return axios({
            url: '/mall/User/ShippingAddress/saveShippingAddress',
            method: 'POST',
            params: query,
            data: shippingAddress
        });
    }

    //修改保存收获地址
    static updateShippingAddress (shippingAddress) {
        const query = {}
        return axios({
            url: '/mall/User/ShippingAddress/updateShippingAddress',
            method: 'POST',
            params: query,
            data: shippingAddress
        });
    }

    //根据ID查询指定的收获地址(只提取ID 和 Name)
    static deleteShippingAddress (shippingAddressId) {
        const query = {
            shippingAddressId
        }
        return axios({
            url: '/mall/User/ShippingAddress/deleteShippingAddress',
            method: 'POST',
            params: query,
        });
    }
}
